//初始化数据
async function initInfo () {
  const res = await axios({ url: 'init/data' })
  if (res.data.code === 0) {
    Toast.success(res.data.message)
  } else {
    Toast.fail(res.data.message)
  }
}

document.querySelector('.user span').innerHTML = localStorage.getItem('username')
document.querySelector('.init').addEventListener('click', () => {
  initInfo()
})

document.querySelector('.logout').addEventListener('click', () => {
  localStorage.clear()
  location.href = './login.html'
})